<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Jialeo\LaravelSchemaExtend\Schema;

class CreateTableWorkOrderOperateLog extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('work_order_operate_log', function (Blueprint $table) {
            $table->id();

            $table->string("workOrderNo", 32)->comment("工单号")->default("");
            $table->unsignedTinyInteger("step")->comment("工单流程步骤")->default(0);
            $table->unsignedTinyInteger("type")->comment("日志类型")->default(0);
            $table->text("content")->comment("日志内容")->default("");

            $table->string("createdUsername", "64")->comment("操作人昵称")->default("");
            $table->unsignedInteger('createdAt')->default(0)->comment('创建时间');
            $table->unsignedInteger('createdByUid')->default(0)->comment('创建人');
            $table->tinyInteger('isDeleted')->default(0);

            $table->collation = 'utf8mb4_general_ci';
            $table->comment   = '工单操作日志记录表';
            $table->index(["workOrderNo"], "idx_workOrderNo");
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('work_order_operate_log');
    }
}
